@extends('layouts.admin')
@section('style')
@endsection
@section('content')
<div class="admin_main">
    <div class="admin_header_fixed">
        <div class="admin_header clearfix">
            <div class="title"><i></i>新增操作员</div>
            <div class="action">
                <b></b>
                <div class="layui-btn-group layui-btn-group-only">
                    <a class="layui-btn layui-btn-primary layui-btn-small " href="{{ url('user') }}">
                        <i class="fa fa-reply"></i> 返回列表
                    </a>
                </div>
            </div>
        </div>
    </div>
    <div class="admin_base">
         <div class="box_form">
            <div class="box_content">
                <form method="post" action="{{ url('user') }}"  id="UserForm"  class="layui-form" novalidate="1">
                    {{ csrf_field() }}
                    <fieldset class="layui-elem-field">
                        <legend style="font-size:16px;margin-bottom:10px">操作员基本信息</legend>
                        <div class="layui-form-item">
                            <label class="layui-form-label"><span>*</span>登录手机号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="mobile" required lay-verify="mobile" data-title="登录手机号" value="" id="mobile"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label"><span>*</span>操作员姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="nickname" lay-verify="required" value="" id="nickname"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label"><span>*</span>常用邮箱</label>
                            <div class="layui-input-inline">
                                <input type="text" name="email" lay-verify="required|email" id="email"  class="layui-input">
                            </div>
                        </div>
                        {{--<div class="layui-form-item">--}}
                            {{--<label class="layui-form-label"><span>*</span>头像图片</label>--}}
                            {{--<div class="layui-input-inline form-upload-image" data-field="avatar" data-mode="1" data-required="true" data-src=""></div>--}}
                        {{--</div>--}}
                        <div class="layui-form-item">
                            <input type="password" style="display: none;" />
                            <label class="layui-form-label"><span>*</span>密码</label>
                            <div class="layui-input-inline">
                                <input type="password" name="password" lay-verify="password" value="" id="password"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item" >
                            <label class="layui-form-label">状态：</label>
                            <div class="layui-input-inline" pane>
                                <input type="checkbox" name="status" value="1" lay-text="正常|禁用" lay-skin="switch" checked />
                            </div>
                        </div>
                    </fieldset>
                    <div class="layui-form-item admin_bottom">
                        <div class="layui-input-inline">
                            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <div class="admin_bottom"></div>
</div>
@endsection
@section('script')
    <script type="text/javascript" src="{{ asset('files/ueditor/ueditor.config.js') }}" ></script>
    <script type="text/javascript" src="{{ asset('files/ueditor/ueditor.all.js') }}" ></script>
    <script type="text/javascript" src="{{ asset('files/ueditor/lang/zh-cn/zh-cn.js') }}" ></script>
    <script type="text/javascript">
        layui.use(['form','element','layer','utils','formField'], function(){
            var form = layui.form;
            var element= layui.element;
            var URL = layui.utils.URL;
            var $ = layui.$;
            form.on('submit(save)',function(data){
                var url  = $(data.form).prop('action');
                var data = data.field;
                URL.post(url,data,{
                    dataType:'json',
                    success:function(res){
                        if(res.code==1){
                            layer.msg(res.message,{icon:6,times:2000},function(){
                                document.location.href = '/user';
                            })
                        }else{
                            layer.msg(res.message,{icon:5,times:2000});
                        }
                    }
                })
                return false;
            })
        });
    </script>
@endsection